import Dialog from '@vant/weapp/dialog/dialog';
Page({
  data: {
    isRead: false,
  },
  handleCheckboxClick(){
    this.setData({
      isRead: !this.data.isRead,
    })
  },
  showStatement() {
    Dialog.confirm({
      title: '推荐转诊声明',
      message: '推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明推荐转诊声明',
      confirmButtonText: "我同意",
      cancelButtonText: "我拒绝",
    }).then(() => {
      this.setData({ isRead: true })
    }).catch(() => {
      this.setData({ isRead: false })
    });
  },

  inspectIsRead(callBack) {
    const { isRead } = this.data;
    if (!isRead) {
      Dialog.confirm({
        title: '请先阅读推荐转诊声明',
      }).then(() => {
        this.showStatement()
      })
    } else callBack();
  },

  quickLogin() {
    this.inspectIsRead(
      () => wx.login({
        success: (res) => {

        },
      })
    )
  },
  getPhoneNumber(e) {
    console.log(e.detail)
  },
})